<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
       <%
       Cookie[] cookies=request.getCookies();
          if(cookies!=null&&cookies.length>0){
        	  for(Cookie c:cookies){
        		  out.print(c.getName()+":"+c.getValue());
        		  out.print("<br>");
        	  }
          }else{
        	  out.print("当前没有cookie，正在创建");
        	  Cookie cookie=new Cookie("name","zxr");
        	  cookie.setMaxAge(10);
        	  response.addCookie(cookie);
          }
       %>
</body>
</html>